package com.ywl.study.transaction.controller;

import com.ywl.study.transaction.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/test")
public class TestController {

    @Autowired
    DemoService demoService;

    @ResponseBody
    @GetMapping
    public String testGlobalTransaction(){
        try{
            demoService.test();
            return "success";
        }catch (Exception e){
            e.printStackTrace();
            return "fail";
        }

    }
}
